
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int a[100005];
int b[100005];

int main() {
  int n, m;
  cin >> n >> m;
  for (int i = 1; i <= m; i++) {
    cin >> a[i] >> b[i];
    a[i]--;
    b[i]--;
  }
  int totoal = (1 << n);
  // int total = pow( 2,n)  ;
  int ans = m;
  for (int s = 0; s < totoal; s++) {
    int res = 0;
    for (int i = 1; i <= m; i++) {
      int A = a[i]; // 第i条边的对应的A点
      int B = b[i]; // 第i条边的对应的B点
      bool color_1 = (s >> A) & 1;
      bool color_2 = (s >> B) & 1;
      if (color_1 == color_2) {
        res++;
      }
    }
    ans = min(ans, res);
  }
  cout << ans;

  return 0;
}